package org.stvd.entities.oauth;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;
import org.stvd.core.annotation.serializer.DateTimeSerializer;
import org.stvd.entities.base.BaseEntity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * Oauth刷新Token-实体类
 * @author houzx
 */
@Entity
@Table(name = "oauth_refresh_token")
public class OauthRefreshToken extends BaseEntity{

    private static final long serialVersionUID = -187215119883501731L;

    /**
     * TokenID
     */
    @Id
    @Column(name = "token_id")
    private String tokenId = "";
    
    /**
     * Token值
     */
    @Column(name = "token")
    private byte[] token = null;
    
    /**
     * 授权信息
     */
    @Column(name = "authentication")
    private byte[] authentication = null;
    
    /**
     * 创建时间
     */
    @Column(name = "create_time", nullable = false)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateTimeSerializer.class)
    private Date createTime = null;

    public String getTokenId() {
        return tokenId;
    }

    public void setTokenId(String tokenId) {
        this.tokenId = tokenId;
    }

    public byte[] getToken() {
        return token;
    }

    public void setToken(byte[] token) {
        this.token = token;
    }

    public byte[] getAuthentication() {
        return authentication;
    }

    public void setAuthentication(byte[] authentication) {
        this.authentication = authentication;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
